package beans;

import ourImage.OurPlanarImage;
import ourfilter.ThresholdFilter;
import pimpmypipe.interfaces.Readable;


/**
 *
 * @author Marcel Meraner
 */
public class ThresholdFilterBean extends FilterBaseBean<ThresholdFilter> {
    
    private double _threshold = 50.0;
    private boolean _filterEnabled = false;
    

    public double getThreshold() {
        return _threshold;
    }

    public void setThreshold(double threshold) {
        if (_threshold != threshold) {
            _threshold = threshold;
            filteringAndNotify();
        }
    }
    
    @Override
    public boolean isFilterEnabled() {
        return _filterEnabled;
    }

    public void setFilterEnabled(boolean enabled) {
        if (enabled != _filterEnabled) {
            _filterEnabled = enabled;
            filteringAndNotify();
        }
    }

    
    @Override
    protected ThresholdFilter getConcreteFilter(Readable<OurPlanarImage> in) {
        return new ThresholdFilter(in, this);
    }
    
    @Override
    protected ThresholdFilter configureConcreteFilter(ThresholdFilter filter) {
        filter.setThreshold(_threshold);
        filter.setFilterEnabled(_filterEnabled);
        return filter;
    }
    
    
    @Override
    public String getFilterName() {
        return "Threshold Filter";
    }

}
